<?php 

	function create_wordpress_admin_slider_submenu()
	{
		add_submenu_page( 'my-top-level-handle', 'Slider Options', 'Slider Options', 'manage_options', 'my-submenu-slider-handle', 'slider_admin_page');
		add_action('admin_init', 'register_slider_settings');
	}
	
	function register_slider_settings()
	{ 
		register_setting('slider_options', 'slider_active');
		register_setting('slider_options', 'slider_selection');
		register_setting('slider_options', 'slider_color');
		
		register_setting('slider_options', 'slide_title');
		register_setting('slider_options', 'slide_second_title');
		register_setting('slider_options', 'slide_text');
		register_setting('slider_options', 'slide_target');
		register_setting('slider_options', 'slide_link');
		register_setting('slider_options', 'slide_img');
		register_setting('slider_options', 'slide_video');
		register_setting('slider_options', 'slide_active');
		
		register_setting('slider_options', 'database_action');
		
		register_setting('slider_options', 'nivo_thumbnails');
		register_setting('slider_options', 'nivo_effects');
		register_setting('slider_options', 'nivo_slices');
		register_setting('slider_options', 'nivo_pause_on_hover');
		register_setting('slider_options', 'nivo_pause_time');
		register_setting('slider_options', 'nivo_animation_speed');
		
		register_setting('slider_options', 'anything_slider_height');
		register_setting('slider_options', 'anything_slider_video_height');
		register_setting('slider_options', 'anything_slider_pause_time');
		register_setting('slider_options', 'anything_slider_animation_speed');
		register_setting('slider_options', 'anything_video_pause_time');
		register_setting('slider_options', 'anything_video_animation_speed');
		
		register_setting('slider_options', 'content_position'); // bx slider
		register_setting('slider_options', 'content_slider_button_type');
		
		register_setting('slider_options', 'carousel_size');
		register_setting('slider_options', 'carousel_width');
		register_setting('slider_options', 'carousel_height');
		register_setting('slider_options', 'carousel_border');
		register_setting('slider_options', 'carousel_scroll_number');
		
	}

	function slider_admin_page() {

	function create_db()
	{
		global $wpdb;
		$create_query = 'CREATE TABLE `'.$wpdb->prefix.'lazar_slider` (
							`id` INT NOT NULL AUTO_INCREMENT ,
							`title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`second_title` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`text` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`target` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`link` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`video` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`img` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`img_original_color` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`img_color` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
							`active` INT NOT NULL ,
							`position` INT NOT NULL ,
							PRIMARY KEY (`id`)
						) ENGINE = MYISAM ;
							';
		$create = $wpdb->get_results($create_query);
	}
	//CHECK FUNCTION
	function check_if_db_exists($database)
	{
		global $wpdb;
		if($wpdb->get_var("SHOW TABLES LIKE '".$database."'") != $database)
			return '';
		
		else 
			return 'table_exists';
	}
		
	global $wpdb;
	if ( check_if_db_exists($wpdb->prefix.'lazar_slider') == '') create_db();
	
	function select_slides()
	{
		global $wpdb;
		$display_slides_query = 'SELECT * FROM `'.$wpdb->prefix.'lazar_slider` ORDER BY position';
		$display_slides = $wpdb->get_results($display_slides_query);
		return $display_slides;
	}

	function insert_slide($id, $title, $second_title, $text, $link, $img, $video) // USED FOR ADDING A SLIDE
	{     
		if ( $id = '' ) $id = NULL;
		if ( $title == '' ) $title = 'no_title';
		if ( $second_title == '' ) $second_title = 'no_second_title';
		if ( $text == '' ) $text = 'no_text';
		if ( $link == '' ) $link = 'no_link';
		if ( $img == '' ) $img = 'no_image';
		if ( $video == '' ) $video = 'no_video';
		
		$target = get_option('slide_target');
		
		
		if ( $img != 'no_image' )
		{
			// process the image color to obtain the average color. will be used further on
			$rTotal = 0;
			$gTotal = 0;
			$bTotal = 0;
			
			$total = 0;
			
			$i = imagecreatefromjpeg($img);
			for ($x = 0; $x < imagesx($i); $x++)
			{
				for ($y=0; $y < imagesy($i); $y++)
				{
					$rgb = imagecolorat($i, $x, $y);
					$r   = ($rgb >> 16) & 0xFF;
					$g   = ($rgb >> 8) & 0xFF;
					$b   = $rgb & 0xFF;
			
					$rTotal += $r;
					$gTotal += $g;
					$bTotal += $b;
					$total++;
				}
			}
			
			$rTotal = (int)($rTotal/$total);
			$gTotal = (int)($gTotal/$total);
			$bTotal = (int)($bTotal/$total);
			
			$average_color[0] = base_convert($rTotal, 10, 16);
			$average_color[1] = base_convert($gTotal, 10, 16);
			$average_color[2] = base_convert($bTotal, 10, 16);
			
			for ( $i = 0; $i < 3; $i++ )
			{
				if ( strlen($average_color[$i]) == 1 )
					$two_digit_average_color[$i] = '0'.$average_color[$i];
					
				else $two_digit_average_color[$i] = $average_color[$i];
			}
												
			$img_original_color = implode($two_digit_average_color);
			$img_color = $img_original_color;

		}
		
		else // if ( $img != 'no_image' )
		{
			$img_original_color = 'no_color';
			$img_color = 'no_color';
		}
		
		
		$active = get_option('slide_active');
		
		global $wpdb;
		
		$position_count_query = 'SELECT * FROM `'.$wpdb->prefix.'lazar_slider` ORDER BY position';
		$position_count = $wpdb->get_results($position_count_query);
		$position = $wpdb->num_rows;
		
		$insert_query = "INSERT INTO `".$wpdb->prefix."lazar_slider` (`id`, `title`, `second_title`, `text`, `target`, `link`, `video`, `img`, `img_original_color`, `img_color`, `active`, `position`) VALUES ('".$id."', '".$title."', '".$second_title."', '".$text."', '".$target."', '".$link."', '".$video."', '".$img."', '".$img_original_color."', '".$img_color."', '".$active."', '".$position."');";
		$insert = $wpdb->get_results($insert_query);	
	}
	
		
	function publish_slide($id)
	{
		global $wpdb;
		$query = "UPDATE ".$wpdb->prefix."lazar_slider SET `active` = '1' WHERE `id` = '$id'";	
		$wpdb->get_results($query);	
		
		$refer = $_SERVER['HTTP_REFERER'].'#tab_current_slides';
		
		echo "<script language=\"JavaScript\">
        <!--
        document.location.href  = \"".$refer."\";
        -->
        </script>";
	}

	function unpublish_slide($id)
	{
		global $wpdb;
		$query = "UPDATE ".$wpdb->prefix."lazar_slider SET `active` = '0' WHERE `id` = '$id'";	
		$wpdb->get_results($query);
		
		$refer = $_SERVER['HTTP_REFERER'].'#tab_current_slides';
		
		echo "<script language=\"JavaScript\">
        <!--
        document.location.href  = \"".$refer."\";
        -->
        </script>";
	}

	function delete_slide($id)
	{
		global $wpdb;
		
		$select_item_query = "SELECT position FROM `".$wpdb->prefix."lazar_slider` WHERE `id` = '$id'";
		$select_item = $wpdb->get_results($select_item_query);
		
		$current_position = $select_item[0]->position;
		
		$recalculate_reorder_query = "SELECT * FROM `".$wpdb->prefix."lazar_slider` WHERE `position` > '$current_position'";
		$recalculate_order = $wpdb->get_results($recalculate_reorder_query);

		foreach ( $recalculate_order as $recalculate )
		{
			$new_position = $recalculate->position-1;
			$update_query = "UPDATE ".$wpdb->prefix."lazar_slider SET `position` = '$new_position' WHERE id = '$recalculate->id'";
			$wpdb->get_results($update_query);
		}

		$delete_query = 'DELETE FROM `'.$wpdb->prefix.'lazar_slider` WHERE id='.$id.' LIMIT 1';
		$wpdb->get_results($delete_query);	

		$refer = $_SERVER['HTTP_REFERER'].'#tab_current_slides';
		
		echo "<script language=\"JavaScript\">
        <!--
        document.location.href  = \"".$refer."\";
        -->
        </script>";
	}
	
	function move_entry_down($id)
	{
		global $wpdb;
		
		$display_slides = select_slides();
        foreach ( $display_slides as $slide )
		
			if ( $slide->id > $id )
			{
				$destination = $slide->id;
				switch_slides($destination, $id);
				return;
			}
	}

	if ( get_option('database_action') == 'create_slide' )
	{
		$insert_title = htmlentities(get_option('slide_title'), ENT_QUOTES);
		$insert_second_title = htmlentities(get_option('slide_second_title'), ENT_QUOTES);
		$insert_text = htmlentities(get_option('slide_text'), ENT_QUOTES);
		$insert_link = htmlentities(get_option('slide_link'), ENT_QUOTES);
		$insert_img = htmlentities(get_option('slide_img'), ENT_QUOTES);
		$insert_video = htmlentities(get_option('slide_video'), ENT_QUOTES);

		insert_slide (NULL, $insert_title, $insert_second_title, $insert_text, $insert_link, $insert_img, $insert_video );
		update_option('database_action','');
		
		$refer = $_SERVER['HTTP_REFERER'].'#tab_add_slide';
		
		echo "<script language=\"JavaScript\">
        <!--
        document.location.href  = \"".$refer."\";
        -->
        </script>";
	}
	
	if(isset($_GET['delete']))
		if($_GET['delete'] != '') delete_slide($_GET['delete']); // IF CALLED DELETES A SLIDE BY ID 
		
	if(isset($_GET['publish']))
		if($_GET['publish'] != '') publish_slide($_GET['publish']); // IF CALLED PUBLISHES A SLIDE BY ID
		
	if(isset($_GET['unpublish']))
		if($_GET['unpublish'] != '') unpublish_slide($_GET['unpublish']); // IF CALLED UNPUBLISHES A SLIDE BY ID
		
	if(isset($_GET['move_up']))
		if($_GET['move_up'] != '') move_entry_up($_GET['move_up']); // IF CALLED MOVES THE SLIDE UP ONE POSITION
		
	if(isset($_GET['move_down']))
		if($_GET['move_down'] != '') move_entry_down($_GET['move_down']); // IF CALLED MOVES THE SLIDE UP ONE POSITION
	
	if ( isset($_POST['update_slide']) && $_POST['update_slide'] == 'true' )
	{
		$update_title = htmlentities($_POST['slide_title'], ENT_QUOTES);
		$update_second_title = htmlentities($_POST['slide_second_title'], ENT_QUOTES);
		$update_text = htmlentities($_POST['slide_text'], ENT_QUOTES);
		$update_img = htmlentities($_POST['slide_img'], ENT_QUOTES);
		$update_link = htmlentities($_POST['slide_link'], ENT_QUOTES);
		$update_video = htmlentities($_POST['slide_video'], ENT_QUOTES);
		
		$update_id = htmlentities($_POST['slide_to_update'], ENT_QUOTES);
		
		if ( $update_title == '' ) $update_title = 'no_title';
		if ( $update_second_title == '' ) $update_second_title = 'no_second_title';
		if ( $update_text == '' ) $update_text = 'no_text';
		if ( $update_link == '' ) $update_link = 'no_link';
		if ( $update_img == '' ) $update_img = 'no_image';
		if ( $update_video == '' ) $update_video = 'no_video';
		
		$update_target = '';
		$update_active = '';
		
		if ( isset($_POST['slide_target']) )
			$update_target = $_POST['slide_target'];
		if ( isset($_POST['slide_active']) )
			$update_active = $_POST['slide_active'];
		
		global $wpdb;
		
		$obtain_original_slide_query = "SELECT * FROM `".$wpdb->prefix."lazar_slider` WHERE `id` = '$update_id'";
		$obtain_original_slide = $wpdb->get_results($obtain_original_slide_query);
		
		if ( $update_img != $obtain_original_slide[0]->img && $update_img != 'no_image' ) // if the images are different but there is an image
		{
			// process the image color to obtain the average color. will be used further on
			$rTotal = 0;
			$gTotal = 0;
			$bTotal = 0;
			
			$total = 0;
			
			$i = imagecreatefromjpeg($update_img);
			for ($x = 0; $x < imagesx($i); $x++)
			{
				for ($y=0; $y < imagesy($i); $y++)
				{
					$rgb = imagecolorat($i, $x, $y);
					$r   = ($rgb >> 16) & 0xFF;
					$g   = ($rgb >> 8) & 0xFF;
					$b   = $rgb & 0xFF;
			
					$rTotal += $r;
					$gTotal += $g;
					$bTotal += $b;
					$total++;
				}
			}
			
			$average_color[0] = base_convert((int)($rTotal/$total), 10, 16);
			$average_color[1] = base_convert((int)($gTotal/$total), 10, 16);
			$average_color[2] = base_convert((int)($bTotal/$total), 10, 16);
			
			for ( $i = 0; $i < 3; $i++ )
			{
				if ( strlen($average_color[$i]) == 1 )
					$two_digit_average_color[$i] = '0'.$average_color[$i];
					
				else $two_digit_average_color[$i] = $average_color[$i];
			}
			
			$update_img_original_color = implode($two_digit_average_color);
			$update_img_color = $update_img_original_color;
			
		} // END // if the images are different but there is an image
		
		if ( $update_img == $obtain_original_slide[0]->img ) // if the images are identical
		{
			$update_img_original_color = $obtain_original_slide[0]->img_original_color;
			$update_img_color = $_POST['slide_color'];
		}
		
		if ( $update_img == 'no_image' )
		{
			$update_img_original_color = 'no_color';
			$update_img_color = 'no_color';
		}
	
		$update_slide_query = "UPDATE ".$wpdb->prefix."lazar_slider
				SET `title` = '$update_title',
					`second_title` = '$update_second_title',
					`text` = '$update_text',
					`target` = '$update_target',
					`link` = '$update_link',
					`video` = '$update_video',
					`img` = '$update_img',
					`img_original_color` = '$update_img_original_color',
					`img_color` = '$update_img_color',
					`active` = '$update_active'
				WHERE `id` = '$update_id'";	
				
		$wpdb->get_results($update_slide_query);	
			
	}
	
	?>

<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/js/colorpicker/css/colorpicker.css" type="text/css" media="all" />
<script type="text/javascript">

 jQuery(document).ready(function() {
	
	// UPLOAD BUTTON
	jQuery('.slide_img_button').click(function() {
		 formfield = jQuery('.slide_img_field').attr('name');
		 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
		 destination = 'slide_img';			 
		 return false;
	});
	
	window.send_to_editor = function(html) {
		switch(destination)
		{
			case 'slide_img':
				imgurl = jQuery('img',html).attr('src');
				jQuery('.slide_img_field').val(imgurl);
			break;
		}
		tb_remove();
	}
								 

	// SORTABLE
   jQuery("#test-list").sortable({
      handle : '.slide-move',
      update : function () {
		  var order = '';
		  jQuery("#test-list tr").each(function(index) {		
					order += jQuery(this).attr('id') + ',' ;												  
				});
		  
		  order = 'order=' + order;
		  <?php  $reorder_path = get_template_directory_uri().'/theme_options/slides_reorder.php'; 
		  echo '
		  jQuery.get("'.$reorder_path.'", order, function(theResponse){
					jQuery("#show_here").html(theResponse);
				});
		  '; 
		  ?>
		  jQuery("#test-list tr").removeClass('alternate');
		  jQuery("#test-list tr:even").addClass('alternate');	
      }
    });
   
   	jQuery('.colorbox').ColorPicker({
		onSubmit: function(hsb, hex, rgb, el) {
			jQuery(el).val(hex);

			jQuery(el).css({
				'background-color': '#'+hex

			});
			jQuery(el).ColorPickerHide();
			
		},
			onBeforeShow: function () {
				jQuery(this).ColorPickerSetColor(this.value);
			}
		})
		.bind('keyup', function(){
		jQuery(this).ColorPickerSetColor(this.value);
	
	});

	jQuery("#slider_tabs").tabs();
	jQuery("#transform").jqTransform();
   
});
</script>

<script type="text/javascript">
	
	function toggleLayer( whichLayer )
	{
		var elem, vis;
		if( document.getElementById ) elem = document.getElementById( whichLayer );
			else if( document.all )  elem = document.all[whichLayer];
			else if( document.layers ) elem = document.layers[whichLayer];
		vis = elem.style;
		if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
			vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
			vis.display = (vis.display==''||vis.display=='block')?'none':'block';
	}
	
	function confirmAction()
	{
		return confirm("Are you sure you want to delete this slide?")
	}
	
</script>

<div class="wrap">  
    
    <div id="icon-options-general" class="icon32"><br /></div>
    <h2>Slider Options</h2>  
    
     <?php
	$get_admin_warnings = admin_warnings();
	if ( $get_admin_warnings != '' )
	{
		echo '<div id="admin_warnings">';
			echo '<div id="admin_warning_icon"></div>';
			echo $get_admin_warnings;
		echo '</div>';
	}
	?>
    
<div id="slider_tabs" class="admin_tabs">
    <ul>
        <li>
            <a href="#tab_slide_settings">
                Settings
            </a>
        </li>
        <li>
            <a href="#tab_add_slide">
                Add Slide
            </a>
        </li>
        <li>
            <a href="#tab_current_slides">
                Current Slides
            </a>
        </li>
    </ul>

	<div id="tab_slide_settings">
        
        <form method="post" action="options.php" id="transform">
        <?php settings_fields('slider_options'); ?>
           
        	<div class="settings_wrapper" style="margin-bottom: 20px;">
            	<div class="header">
                    Settings
                </div>
                <div class="row_data">
                	<div class="row clearfix alternate">
						<?php $slider_active = get_option('slider_active'); if ( $slider_active == '' ) $slider_active = 'no';  ?>
                        <label>Use slider:</label>
                        <select name="slider_active" class="general_options_select">
                            <option value="yes" <?php if ($slider_active == 'yes') { echo 'selected="selected"'; } ?>>Yes</option>
                            <option value="no" <?php if ($slider_active == 'no') { echo 'selected="selected"'; } ?>>No</option>
                        </select>
                    </div>
                        
                    <?php $slider_selection = get_option('slider_selection'); if ( $slider_selection == '' ) $slider_selection = 'nivo_slider';  ?>
                    
                    <div class="row clearfix">
						<?php $slider_color = get_option('slider_color', 'individual_color'); ?>
                        <label>Slider Color:</label>
                        <select name="slider_color" class="general_options_select">
                            <option value="individual_color" <?php if ($slider_color == 'individual_color') { echo 'selected="selected"'; } ?>>Individual Color</option>
                            <option value="theme_color" <?php if ($slider_color == 'theme_color') { echo 'selected="selected"'; } ?>>Theme Color</option>
                        </select>
                    </div>
                        
           			<div class="row clearfix alternate">
                        <label>Which slider:</label>
                        <select name="slider_selection" onchange="this.form.submit()">
                            <option value="nivo_slider" <?php if ($slider_selection == 'nivo_slider') { echo 'selected="selected"'; } ?>>Nivo Slider</option>
                            <option value="anything_slider" <?php if ($slider_selection == 'anything_slider') { echo 'selected="selected"'; } ?>>Anything Slider</option>
                            <option value="anything_video" <?php if ($slider_selection == 'anything_video') { echo 'selected="selected"'; } ?>>Anything Slider Video</option>
                            <option value="bx_slider" <?php if ($slider_selection == 'bx_slider') { echo 'selected="selected"'; } ?>>BX Slider</option>
                            <option value="carousel" <?php if ($slider_selection == 'carousel') { echo 'selected="selected"'; } ?>>Carousel</option>
                            <option value="wide_slider" <?php if ($slider_selection == 'wide_slider') { echo 'selected="selected"'; } ?>>Wide Slider</option>
                            <option value="piecemaker" <?php if ($slider_selection == 'piecemaker') { echo 'selected="selected"'; } ?>>Piecemaker</option>
                            <option value="accordion_slider" <?php if ($slider_selection == 'accordion_slider') { echo 'selected="selected"'; } ?>>Accordion Slider</option>
                            <option value="complex_slider" <?php if ($slider_selection == 'complex_slider') { echo 'selected="selected"'; } ?>>Complex Slider</option>
                        </select>
					</div>
                </div> <!-- .row_data -->
             </div> <!-- .settings_wrapper -->
             
             <div class="settings_wrapper">
                <div class="row_data">
                    <div class="settings_form" <?php if ( get_option('slider_selection') != 'nivo_slider' ) echo ' style="display: none;"'; ?>>
                    	<div class="header">
                            Nivo Settings
                        </div>
                        
                        <div class="row clearfix">
                            <label>Big Thumbnails:</label>
                            <select name="nivo_thumbnails">
                                <option value="on" <?php if ( get_option('nivo_thumbnails') == 'on' ) echo 'selected="selected"'; ?>>On</option>
                                <option value="off" <?php if ( get_option('nivo_thumbnails') == 'off' ) echo 'selected="selected"'; ?>>Off</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Transition Effects:</label>
                            <select name="nivo_effects">
                                <option value="fade"               <?php if ( get_option('nivo_effects') == 'fade' )              echo 'selected="selected"'; ?>>Fade</option>
                                <option value="random"             <?php if ( get_option('nivo_effects') == 'random' )            echo 'selected="selected"'; ?>>Random</option>
                                <option value="sliceDown"          <?php if ( get_option('nivo_effects') == 'sliceDown' )         echo 'selected="selected"'; ?>>Slice Down</option>
                                <option value="sliceDownLeft"      <?php if ( get_option('nivo_effects') == 'sliceDownLeft' )     echo 'selected="selected"'; ?>>Slice Down Left</option>
                                <option value="sliceUp"            <?php if ( get_option('nivo_effects') == 'sliceUp' )           echo 'selected="selected"'; ?>>Slice Up</option>
                                <option value="sliceUpLeft"        <?php if ( get_option('nivo_effects') == 'sliceUpLeft' )       echo 'selected="selected"'; ?>>Slice Up Left</option>
                                <option value="sliceUpDown"        <?php if ( get_option('nivo_effects') == 'sliceUpDown' )       echo 'selected="selected"'; ?>>Slice Up Down</option>
                                <option value="sliceUpDownLeft"    <?php if ( get_option('nivo_effects') == 'sliceUpDownLeft' )   echo 'selected="selected"'; ?>>Slice Up Down Left</option>
                                <option value="fold"               <?php if ( get_option('nivo_effects') == 'fold' )              echo 'selected="selected"'; ?>>Fold</option>
                                <option value="slideInRight"       <?php if ( get_option('nivo_effects') == 'slideInRight' )      echo 'selected="selected"'; ?>>Slide In Right</option>
                                <option value="slideInLeft"        <?php if ( get_option('nivo_effects') == 'slideInLeft' )       echo 'selected="selected"'; ?>>Slide In Left</option>
                                <option value="boxRandom"          <?php if ( get_option('nivo_effects') == 'boxRandom')          echo 'selected="selected"'; ?>>Box Random</option>
                                <option value="boxRain"            <?php if ( get_option('nivo_effects') == 'boxRain')            echo 'selected="selected"'; ?>>Box Rain</option>
                                <option value="boxRainReverse"     <?php if ( get_option('nivo_effects') == 'boxRainReverse')     echo 'selected="selected"'; ?>>Box Rain Reverse</option>
                                <option value="boxRainGrow"        <?php if ( get_option('nivo_effects') == 'boxRainGrow')        echo 'selected="selected"'; ?>>Box Rain Grow</option>
                                <option value="boxRainGrowReverse" <?php if ( get_option('nivo_effects') == 'boxRainGrowReverse') echo 'selected="selected"'; ?>>Box Rain Grow Reverse</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Number of slices:</label>
                            <select name="nivo_slices">
                                <option value="5" <?php if ( get_option('nivo_slices') == '5' ) echo 'selected="selected"'; ?>>5</option>
                                <option value="10" <?php if ( get_option('nivo_slices') == '10' ) echo 'selected="selected"'; ?>>10</option>
                                <option value="15" <?php if ( get_option('nivo_slices') == '15' ) echo 'selected="selected"'; ?>>15</option>
                                <option value="20" <?php if ( get_option('nivo_slices') == '20' ) echo 'selected="selected"'; ?>>20</option>
                                <option value="25" <?php if ( get_option('nivo_slices') == '25' ) echo 'selected="selected"'; ?>>25</option>
                                <option value="30" <?php if ( get_option('nivo_slices') == '30' ) echo 'selected="selected"'; ?>>30</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Pause on hover:</label>
                            <select name="nivo_pause_on_hover">
                                <option value="true" <?php if ( get_option('nivo_pause_on_hover') == 'true' ) echo 'selected="selected"'; ?>>True</option>
                                <option value="false" <?php if ( get_option('nivo_pause_on_hover') == 'false' ) echo 'selected="selected"'; ?>>False</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Pause time:</label>
                            <input type="text" class="input_box" name="nivo_pause_time" value="<?php echo get_option('nivo_pause_time', '50000'); ?>" />
                            <div class="right_note">
                            	ms
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Animation speed:</label>
                            <input type="text" class="input_box" name="nivo_animation_speed" value="<?php echo get_option('nivo_animation_speed', '250'); ?>" />
                            <div class="right_note">
                            	ms
                            </div>
                        </div>
                        
                        <div class="row clearfix">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                        </div>
					</div> <!-- .row_data -->
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'anything_slider' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        Anything Slider Settings
                    </div>
                    
                    <div class="row_data">
                        <div class="row clearfix">
                            <label>Height:</label>
                            <input type="text" class="input_box" name="anything_slider_height" value="<?php echo get_option('anything_slider_height'); ?>" />
                            <div class="right_note">
                            	px (default value = 385 px)
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Pause time:</label>
                            <input type="text" class="input_box" name="anything_video_pause_time" value="<?php echo get_option('anything_video_pause_time', '50000'); ?>" />
                            <div class="right_note">
                            	ms
                            </div>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Animation speed:</label>
                            <input type="text" class="input_box" name="anything_video_animation_speed" value="<?php echo get_option('anything_video_animation_speed', '250'); ?>" />
                            <div class="right_note">
                            	ms
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                        </div>
					</div>
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'anything_video' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        Anything Slider + VIDEO Settings
                    </div>
                    
                	<div class="row_data">
                        <div class="row clearfix">
                            <label>Height:</label>
                            <input type="text" class="input_box" name="anything_slider_video_height" value="<?php echo get_option('anything_slider_video_height'); ?>" />
                            <div class="right_note">
                            	px (default value = 530 px)
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Pause time:</label>
                            <input type="text" class="input_box" name="anything_slider_pause_time" value="<?php echo get_option('anything_slider_pause_time', '50000'); ?>" />
                            <div class="right_note">
                            	ms
                            </div>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Animation speed:</label>
                            <input type="text" class="input_box" name="anything_slider_animation_speed" value="<?php echo get_option('anything_slider_animation_speed', '250'); ?>" />
                            <div class="right_note">
                            	ms
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                        </div>
                    </div>
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'bx_slider' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        BX Slider
                    </div>
                    
                	<div class="row_data">
                    	<div class="row clearfix">
                            <label>Content_position:</label>
                            <select name="content_position">
                                <option value="left_alignment" <?php if ( get_option('content_position') == 'left_alignment' ) echo 'selected="selected"'; ?>>Left</option>
                                <option value="right_alignment" <?php if ( get_option('content_position') == 'right_alignment' ) echo 'selected="selected"'; ?>>Right</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Button Type:</label>
                            <select name="content_slider_button_type">
                                <option value="link" <?php if ( get_option('content_slider_button_type') == 'link' ) echo 'selected="selected"'; ?>>Link</option>
                                <option value="button" <?php if ( get_option('content_slider_button_type') == 'button' ) echo 'selected="selected"'; ?>>Button</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                        </div>
					</div> <!-- .row_data -->
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'wide_slider' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        Wide Slider
                    </div>
                    
                	<div class="row_data">
                        <div class="row clearfix">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                            <div class="note">This slider only works with minimum 3 slides!</div>
                        </div>
					</div> <!-- .row_data -->
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'piecemaker' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        Piecemaker
                    </div>
                    
                	<div class="row_data">
                        <div class="row clearfix">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                        </div>
					</div> <!-- .row_data -->
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'accordion_slider' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        Accordion Slider
                    </div>
                    
                    <div class="row_data">
                        <div class="row clearfix">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                            <div class="note">This slider only works with minimum 3 and maximum first 6 slides!</div>
                        </div>
					</div> <!-- .row_data -->
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'complex_slider' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        Complex Slider
                    </div>
                    
                	<div class="row_data">
                        <div class="row clearfix">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                            <div class="note">This slider only works with minimum 3 slides!</div>
                        </div>
					</div> <!-- .row_data -->
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') == '' ) echo ' style="display: block;"'; else echo ' style="display: none;"';?>>
                	<div class="header">
                        General Slider Settings
                    </div>
                    
                    <div class="row_data">
                        <div class="row clearfix">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                            <div class="note">Please select a slider and configure your slideshow!</div>
                        </div>
					</div> <!-- .row_data -->
                </div>
                
                <div class="settings_form" <?php if ( get_option('slider_selection') != 'carousel' ) echo ' style="display: none;"'; ?>>
                	<div class="header">
                        Carousel
                    </div>
                    
                	<div class="row_data">
                    	<div class="row clearfix">
                            <label>Carousel Size:</label>
                            <select name="carousel_size">
                                <option value="custom" <?php if ( get_option('carousel_size') == 'custom' ) echo 'selected="selected"'; ?>>Custom</option>
                                <option value="tall"   <?php if ( get_option('carousel_size') == 'tall' )   echo 'selected="selected"'; ?>>Tall ( w:250 h:350 )</option>
                                <option value="square" <?php if ( get_option('carousel_size') == 'square' ) echo 'selected="selected"'; ?>>Square ( w:350 h:350 )</option>
                                <option value="wide"   <?php if ( get_option('carousel_size') == 'wide' )   echo 'selected="selected"'; ?>>Wide ( w:500 h:350 )</option>
                            </select>
                    	</div>
                        
                        <div class="row clearfix alternate">
                            <label>Image width:</label>
                            <input type="text" class="input_box" name="carousel_width" value="<?php echo get_option('carousel_width'); ?>" />
                            <div class="right_note">
                            	px
                            </div>
                        </div>
                    
                    	<div class="row clearfix">
                            <label>Image height:</label>
                            <input type="text" class="input_box" name="carousel_height" value="<?php echo get_option('carousel_height'); ?>" />
                            <div class="right_note">
                            	px
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Image Border:</label>
                            <select name="carousel_border">
                                <option value="on" <?php if ( get_option('carousel_border') == 'on' ) echo 'selected="selected"'; ?>>On</option>
                                <option value="off" <?php if ( get_option('carousel_border') == 'off' ) echo 'selected="selected"'; ?>>Off</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Number of elements to scroll:</label>
                            <select name="carousel_scroll_number">
                                <option value="1" <?php if ( get_option('carousel_scroll_number') == '1' ) echo 'selected="selected"'; ?>>1</option>
                                <option value="2" <?php if ( get_option('carousel_scroll_number') == '2' ) echo 'selected="selected"'; ?>>2</option>
                                <option value="3" <?php if ( get_option('carousel_scroll_number') == '3' ) echo 'selected="selected"'; ?>>3</option>
                                <option value="4" <?php if ( get_option('carousel_scroll_number') == '4' ) echo 'selected="selected"'; ?>>4</option>
                                <option value="5" <?php if ( get_option('carousel_scroll_number') == '5' ) echo 'selected="selected"'; ?>>5</option>
                                <option value="6" <?php if ( get_option('carousel_scroll_number') == '6' ) echo 'selected="selected"'; ?>>6</option>
                                <option value="7" <?php if ( get_option('carousel_scroll_number') == '7' ) echo 'selected="selected"'; ?>>7</option>
                                <option value="8" <?php if ( get_option('carousel_scroll_number') == '8' ) echo 'selected="selected"'; ?>>8</option>
                                <option value="9" <?php if ( get_option('carousel_scroll_number') == '9' ) echo 'selected="selected"'; ?>>9</option>
                                <option value="10" <?php if ( get_option('carousel_scroll_number') == '10' ) echo 'selected="selected"'; ?>>10</option>
                                
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <input name="Submit" type="submit" class="save_button" value="<?php esc_attr_e('Save Changes'); ?>" />
                        </div>
                    </div> <!-- .row_data -->
                </div>
                
                <div class="footer">
                    Settings
                </div>
                
			</div> <!-- .settings_wrapper -->
    </div> <!-- #tab_slide_settings -->
	
    
    
    <div id="tab_add_slide">
    	
        <div class="settings_form">

                <div class="settings_wrapper">
                    <div class="header">
                        Add slide
                    </div>
                    <div class="row_data">
                    
                        <div class="row clearfix alternate">
                            <label>Title</label>
                            <input type="text" name="slide_title" class="input_box" value="" size="20"/>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Second title</label>
                            <input type="text" name="slide_second_title" class="input_box add_slide_input" value="" size="20"/>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Description</label>
                            <textarea rows="8" cols="200;" name="slide_text" class="input_box"></textarea>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Image</label>
                            <input type="text" name="slide_img" class="input_box slide_img_field" value="" size="20"/>
                            <input class="slide_img_button browse_button" value="Browse" type="button" />
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Target: </label>
                            <div class="radio_button">
                                <input type="radio" name="slide_target" value="link" checked="checked" /> URL
                            </div>
                            <div class="radio_button">
                                <input type="radio" name="slide_target" value="image" /> Image
                            </div>
                            <div class="radio_button">
                                <input type="radio" name="slide_target" value="video" /> Video
                            </div>
                        </div>
                        
                        <div class="row clearfix">
                            <label>URL</label>
                            <input type="text" name="slide_link" class="input_box" value="" size="20"/>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Video</label>
                            <input type="text" name="slide_video" class="input_box" value="" size="20"/>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Publish slide</label>
                            <div class="radio_button">
                                <input type="radio" name="slide_active" checked="checked" value="1" /> Yes
                            </div>
                            <div class="radio_button">
                                <input type="radio" name="slide_active" value="0" /> No
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <input id="remember_database_action" type="hidden" name="database_action" value="" />
                            <input type="submit" class="add_content_button" onclick="javascript:document.getElementById('remember_database_action').value='create_slide'" value="Add Slide"/>
                        </div>
                    </div> <!-- END .row_data -->
                    
                    <div class="footer">
                        Add slide
                    </div>
                    
                </div>
             </form>
             
        </div>
        
    </div> <!-- END #tab_add_slide -->



	<div id="tab_current_slides">
    <?php
	
		if (check_if_db_exists($wpdb->prefix.'lazar_slider'))
		{
    		$display_slides = select_slides();
			
			if ($display_slides != '')
			{
			?>
				<div class="settings_form">
					<table id="sort_slider" class="display_elements" cellspacing="0">
						<thead>
							<tr>
								<th class="title">Title</th>
								<th class="title">Text</th>
								<th>Image</th>
								<th>Order</th> 
								<th>Edit</th>
								<th>Published</th>   
								<th>Delete</th>     
							</tr>           
						</thead>
		
						<tbody id="test-list">
						
						<?php
						
						$i = 0;
										
						
						$contor = 0;
						foreach ( $display_slides as $key => $slide )
						{	
							if ($i == 0) echo '<tr id="'.$slide->id.'" class="alternate" valign="top">';
							else echo '<tr id="'.$slide->id.'">';
							
								$contor++;
								
								echo '<td class="title" valign="center">';
									if ( $slide->title == 'no_title' )
										echo 'No Title'; else echo $slide->title;
										
									if ( $slide->second_title != 'no_second_title' )
										echo '<span>"'.$slide->second_title.'"</span>';
								echo '</td>';
								
								echo '<td class="title" valign="center">';
									if ( $slide->text == 'no_text' )
										echo 'No description';
									else
									{
										if ( strlen($slide->text) > 130 )
											echo substr($slide->text, 0, 130).'...';
										else 
											echo $slide->text;
									}
								echo '</td>';
								
								echo '<td valign="center" align="center">';
									if ( $slide->img != 'no_image' )
									{
										echo '<a href="'.get_template_directory_uri().'/includes/timthumb.php?src='.$slide->img.'&amp;h=385&amp;w=960&amp;zc=1&amp;q=100">';
											echo '<img src="'.get_template_directory_uri().'/includes/timthumb.php?src='.$slide->img.'&amp;h=68&amp;w=120&amp;zc=1&amp;q=100" alt="'.$slide->title.'" />';
										echo '</a>';
									}
									else
										echo 'No Image';
								echo '</td>';
								
								echo '<td valign="center" align="center">';
									echo '<a href="#" class="slide-move">MOVE</a>';
								echo '</td>';
									 
								echo '<td valign="center" align="center">';
									echo '<a class="edit "onclick="javascript:toggleLayer(\'edit_slide_'.$key.'\')" title="Edit Slide '.$key.'" href="#jump_to_slide_'.$key.'">Edit</a>';
								echo '</td>';
								
								echo '<td valign="center" align="center">';
									if ( $slide->active == 1 )
										echo '<a class="unpublish" href="?page=my-submenu-slider-handle&amp;unpublish='.$slide->id.'">Unpublish</a>';
									if ( $slide->active == 0 )
										echo '<a class="publish" href="?page=my-submenu-slider-handle&amp;publish='.$slide->id.'">Publish</a>';
								echo '</td>';
								
								echo '<td valign="center" align="center">';
									echo '<a class="delete" onClick="return confirmAction()" href="?page=my-submenu-slider-handle&amp;delete='.$slide->id.'">Delete</a>';
								echo '</td>';
									  
							echo '</tr>';
							$i++;
							if ($i == 2) $i = 0;
						} // END foreach
						
						?>
						</tbody>
						
						<tfoot>
							<tr>
								<th>Title</th>
								<th>Text</th>
								<th>Image</th>
								<th>Order</th> 
								<th>Edit</th>
								<th>Published</th>
								<th>Delete</th>
							</tr>           
						</tfoot>
						
					</table>    
                    
						<?php
						// Edit slides	
						
						
						
						foreach ( $display_slides as $key => $slide )
						{ 
							echo '<div id="jump_to_slide_'.$key.'"></div>';
							echo '<form method="post" action="'; echo home_url(); echo '/wp-admin/admin.php?page=my-submenu-slider-handle#tab_current_slides" autocomplete="off">';
								echo '<div id="edit_slide_'.$key.'" class="edit_slide settings_wrapper">';
									echo '<div class="header">';
										echo 'Edit slide: ';
										if ( $slide->title == 'no_title' )
											echo 'No Title';
										else echo $slide->title;
										echo '<div class="close">';
											echo '<a class="browse_button "onclick="javascript:toggleLayer(\'edit_slide_'.$key.'\')" title="Edit Slide '.$key.'" href="#'.$slide->id.'">Close</a>';
										echo '</div>';
									echo '</div>';
									echo '<div class="row_data">';
									
										echo '<div class="row clearfix alternate">';
											echo '<label>Title</label>';
											if ( $slide->title != 'no_title') $slide_title = $slide->title;
											else $slide_title = '';
											echo '<input type="text" name="slide_title" class="input_box" value="'.$slide_title.'" size="20"/>';
										echo '</div>';
										
										echo '<div class="row clearfix">';
											echo '<label>Second title</label>';
											if ( $slide->second_title != 'no_second_title') $slide_second_title = $slide->second_title;
											else $slide_second_title = '';
											echo '<input type="text" name="slide_second_title" class="input_box add_slide_input" value="'.$slide_second_title.'" size="20"/>';
										echo '</div>';
										
										echo '<div class="row clearfix alternate">';
											echo '<label>Description</label>';
											if ( $slide->text != 'no_text') $slide_text = $slide->text;
											else $slide_text = '';
											echo '<textarea rows="8" cols="200;" name="slide_text" class="input_box">'.$slide_text.'</textarea>';
										echo '</div>';
										
										echo '<div class="row clearfix">';
											echo '<label>Image</label>';
											if ( $slide->img != 'no_image') $slide_image = $slide->img;
											else $slide_image = '';
											echo '<input type="text" name="slide_img" class="input_box" value="'.$slide_image.'" size="20"/>';
										echo '</div>';
										
										echo '<div class="row clearfix alternate">';
											echo '<label>Color</label>';
											if ( $slide->img_original_color != 'no_color' )
											{
												$img_original_color = $slide->img_original_color;
												$img_color = $slide->img_color;
												
												echo '<div class="color_element clearfix">';
													echo '<div class="colorbox_wrapper">';
														echo '<div class="colorbox" style="background-color: #'.$img_original_color.';">';
															echo $img_original_color;
														echo '</div>';
													echo '</div>';
													echo '<div class="info_text">original color</div>';
												echo '</div>';
												
												echo '<div class="color_element clearfix">';
													echo '<div class="colorbox_wrapper">';
														echo '<input 
																	type="text" 
																	class="colorbox" 
																	style="background-color: #'.$img_color.';" 
																	value="'.$img_color.'" 
																	name="slide_color" 
															  />';
													echo '</div>';
													echo '<div class="info_text">manual select</div>';
												echo '</div>';
												
											} // END if ( $slide->img_original_color != 'no_color' )
											
											if ( $slide->img_original_color == 'no_color' )
											{
												echo '<div class="no_image_warning">';
													echo 'You need to add an image in order to use colors!';
												echo '</div>';
											}
											//echo '<input type="text" name="slide_img" class="input_box" value="'.$slide_image.'" size="20"/>';
										echo '</div>';
										
										echo '<div class="row clearfix">';
											echo '<label>Target: </label>';
											echo '<div class="radio_button">';
												echo '<input type="radio" name="slide_target"'; if ($slide->target == 'link') echo ' checked="checked"'; echo ' value="link" /> URL';
											echo '</div>';
											echo '<div class="radio_button">';
												echo '<input type="radio" name="slide_target"'; if ($slide->target == 'image') echo ' checked="checked"'; echo ' value="image" /> Image';
											echo '</div>';
											echo '<div class="radio_button">';
												echo '<input type="radio" name="slide_target"'; if ($slide->target == 'video') echo ' checked="checked"'; echo ' value="video" /> Video';
											echo '</div>';
										echo '</div>';
										
										echo '<div class="row clearfix alternate">';
											echo '<label>URL</label>';
											if ( $slide->link != 'no_link') $slide_link = $slide->link;
											else $slide_link = '';
											echo '<input type="text" name="slide_link" class="input_box" value="'.$slide_link.'" size="20"/>';
										echo '</div>';
										
										echo '<div class="row clearfix">';
											echo '<label>Video</label>';
											if ( $slide->video != 'no_video') $slide_video = $slide->video;
											else $slide_video = '';
											echo '<input type="text" name="slide_video" class="input_box" value="'.$slide_video.'" size="20"/>';
										echo '</div>';
										
										echo '<div class="row clearfix alternate">';
											echo '<label>Publish slide</label>';
											echo '<div class="radio_button">';
												echo '<input type="radio" name="slide_active"'; if ($slide->active == '1') echo ' checked="checked"'; echo ' value="1" /> Yes ';
											echo '</div>';
											echo '<div class="radio_button">';
												echo '<input type="radio" name="slide_active"'; if ($slide->active == '0') echo ' checked="checked"'; echo ' value="0" /> No';
											echo '</div>';
										echo '</div>';
										
										echo '<div class="row clearfix">';
											echo '<input type="hidden" name="slide_to_update" value="'.$slide->id.'" />';
											echo '<input type="hidden" name="update_slide" value="true" />';
											echo '<input type="submit" class="save_button" value="Update Slide"/>';
										echo '</div>';
									echo '</div> <!-- END .row_data -->';
									
									echo '<div class="footer">';
										echo 'Edit slide: ';
										if ( $slide->title == 'no_title' )
											echo 'No Title';
										else echo $slide->title;
										echo '<div class="close">';
											echo '<a class="browse_button "onclick="javascript:toggleLayer(\'edit_slide_'.$key.'\')" title="Edit Slide '.$key.'" href="#'.$slide->id.'">Close</a>';
										echo '</div>';
									echo '</div>';
									
								echo '</div>';
							echo '</form>';
						} // END foreach ( $display_slides as $slide ) - for editing slides
								
						?>
			 
				</div> <!-- END .settins_form -->
            <?php
            
			} // END if ($display_slides != '')
       	
		} // END if (check_db_existance($wpdb->prefix.'lazar_slider'))
		
		else 
		{
			echo 'Nu avem slideuri';	
		}
		
		?>
    
    </div> <!-- END #tab_current_slides -->
    
    <br />
    
    	</div> <!-- END #slider_tabs  -->
    </div> <!-- END  .wrap  -->    
    
    <?php
	}
?>